package cn.udrm.water.base.v1.frontpages.org;

import org.springframework.stereotype.Component;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestParam;

import cn.udrm.water.base.v1.commons.annotations.Router;

/**
 * 组织机构首页路由
 * @author liukang
 * @date 2019年3月22日
 */
@Component
@Router(value="router/org")
public class OrgIndexRouter {
	
	@Router(value="index")
	public String index() {
		return "org/orgIndex";
	}
	
	@Router(value="defaultPage")
	public String defaultPage() {
		return "org/defaultPage";
	}
	
	@Router(value="deptAuthorize")
	public String deptAuthorize(@RequestParam(value="deptId") String deptId, @RequestParam(value="orgId") String orgId, ModelMap modelMap) {
		modelMap.addAttribute("deptId", deptId);
		modelMap.addAttribute("orgId", orgId);
		return "org/authorize/deptAuthorize";
	}
	@Router(value="personAuthorize")
	public String personAuthorize(@RequestParam(value="personId") String personId, @RequestParam(value="orgId") String orgId, ModelMap modelMap) {
		modelMap.addAttribute("personId", personId);
		modelMap.addAttribute("orgId", orgId);
		return "org/authorize/personAuthorize";
	}
	
	@Router(value="orgAdd")
	public String orgAdd(@RequestParam(value="id", required=false) String id, ModelMap modelMap) {
		modelMap.addAttribute("id", id);
		return "org/add/orgAdd";
	}
	
	@Router(value="deptAdd")
	public String deptAdd(@RequestParam(value="orgId") String orgId, @RequestParam(value="parentId", required=false) String parentId, @RequestParam(value="id", required=false) String id, ModelMap modelMap) {
		modelMap.addAttribute("orgId", orgId);
		modelMap.addAttribute("parentId", parentId);
		modelMap.addAttribute("id", id);
		return "org/add/deptAdd";
	}
	
	@Router(value="roleAdd")
	public String roleAdd(@RequestParam(value="orgId") String orgId, @RequestParam(value="id", required=false) String id, ModelMap modelMap) {
		modelMap.addAttribute("orgId", orgId);
		modelMap.addAttribute("id", id);
		return "org/add/roleAdd";
	}
	
	@Router(value="personAdd")
	public String personAdd(@RequestParam(value="parentId") String parentId, @RequestParam(value="id", required=false) String id, ModelMap modelMap) {
		modelMap.addAttribute("parentId", parentId);
		modelMap.addAttribute("id", id);
		return "org/add/personAdd";
	}
	
	
	@Router(value="orgDetail")
	public String orgDetail(@RequestParam(value="id") String id, ModelMap modelMap) {
		modelMap.addAttribute("id", id);
		return "org/detail/orgDetail";
	}
	
	@Router(value="deptDetail")
	public String deptDetail(@RequestParam(value="id") String id, ModelMap modelMap) {
		modelMap.addAttribute("id", id);
		return "org/detail/deptDetail";
	}
	
	@Router(value="roleDetail")
	public String roleDetail(@RequestParam(value="id") String id, ModelMap modelMap) {
		modelMap.addAttribute("id", id);
		return "org/detail/roleDetail";
	}
	
	@Router(value="personDetail")
	public String personDetail(@RequestParam(value="id") String id, ModelMap modelMap) {
		modelMap.addAttribute("id", id);
		return "org/detail/personDetail";
	}

}
